CKEDITOR.dialog.add("multiimg",function(editor) { 
	var ROOT_PATH = "./components/";    // your root path 
	var filebrowserImageUploadUrl = encodeURIComponent(editor.config.filebrowserImageUploadUrl);
	
	return {  
		title: "批量上传图片",  
		contents: [{  
			id: "tab1",  
			label: "",  
			title: "",  
			padding: 0,  
			elements: [
			{
				type: 'hbox',
				id: 'size',
				widths: [ '250px', '100px','100px' ],
				align: 'left',
				children: [ 
					{
						type: 'radio',
						id: 'align',
						style: "margin-top:4px",
						label: editor.lang.common.align,
						items: [
							[editor.lang.common.alignCenter, 'center'],
							[editor.lang.common.alignLeft, 'left'],
							[editor.lang.common.alignRight, 'right'],
							[editor.lang.common.alignNone, 'none']
						],
						'default': 'center'
					},
					{
						type: 'text',
						id: 'width',
						label: editor.lang.common.width,
						"default": ""
					},
					{
						type: 'text',
						id: 'height',
						"default": "",
						label: editor.lang.common.height
					}	
				]
			},
			{  
				type: "html",  
				style: "min-width:824px;min-height:500px;",  
				html: '<iframe id="uploadFrame" src="'+ROOT_PATH +'ckeditor/plugins/multiimg/dialogs/image.html?v=' +new Date().getSeconds()+"&filebrowserImageUploadUrl="+filebrowserImageUploadUrl + '" frameborder="0"></iframe>'  
			}]  
		}], 
		
		onOk: function() {
			var ckeditorMultiImgs = window.parent.ckeditorMultiImgs || [];
			if(ckeditorMultiImgs.length>0){
				return false;
			}
			
			var align = this.getContentElement('tab1', 'align').getValue();
			var width = this.getContentElement('tab1', 'width').getValue();
			var height = this.getContentElement('tab1', 'height').getValue();
			
			var style = "";
			if(width!="") style+="width:"+width+"px;";
			if(height!="") style+="width:"+height+"px;";
			if(align=="left"){
				style += "float:left;margin-left:10px;";
			}else if(align=="right"){
				style += "float:right;margin-right:10px;";
			}else if(align=="center"){
				style += "margin-left:auto;margin-right:auto;display: block;";
			}
			
			var imgs = window.uploadedImgs || [];
			var num = imgs.length;
			var imgHtml = "";
			for(var i=0;i<num;i++){  
				imgHtml += "<img src=\"" + imgs[i] + "\" style=\""+style+"\"/>";   
			}
			editor.insertHtml(imgHtml);
		},  
		onShow: function () {
		    document.getElementById("uploadFrame").setAttribute("src", ROOT_PATH +"ckeditor/plugins/multiimg/dialogs/image.html?v=" + new Date().getSeconds().toString()+"&filebrowserImageUploadUrl="+filebrowserImageUploadUrl);
		} 
	}  
})  
 